show variables like 'innodb_log%';

show variables like 'innodb_flush_log_at_trx_commit';

当前mysql服务的临时配置, 修改配置文 my.ini my.cnf

set @@global.innodb_flush_log_at_trx_commit = 2;
set @@global.innodb_flush_log_at_trx_commit = 1;
set @@global.innodb_flush_log_at_trx_commit = 0;

show engine innodb status;

select count(*) from admin_user; -- 10350 10355

第一个进程
用到事务 用到锁

共享锁: 只可以读不可以写 
select * from table where id = xxx lock in share mode; 

排他锁: 不可以读不可以写  
凡是执行 insert update delete  都会默认加上一个排他锁
select * from table where id = xxx for update; 

数据加锁之后 普通 的 select * from table_name 是可以查询到数据的

死锁情况:

共享锁有什么作用？

begin;  1

2
select * from admin_user  where user_id = 1 lock in share mode; 


5
update admin_user set user_name = '1oo' where user_id = 1;


select * from admin_user where user_id = 1

commit;

commit;
show variables like '%iso%';






alter table count add column version char(20) default 0;
begin;

select * from count 
where prefix = 'dz10021'
for update;;

update count set count = 33
where  prefix = 'dz10021';


commit;

show status like 'innodb_row_lock%';


















-